package com.playball.lottery.util;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Map;

/**
 * 竞彩选号列表界面对选择的赛事进行时间大小排序,时间在前的排在前面
 * @author Administrator
 *
 */
public class JCxhlbSortList {

	/**
	 * 按赛事mid进行升序排序
	 * @param list 待排序列表
	 * @return 排序后list
	 */
	public static ArrayList<HashMap<String, Object>> SortListData(ArrayList<HashMap<String, Object>> list) {

		if (!list.isEmpty()) {
			Collections.sort(list, new Comparator<HashMap<String, Object>>() {
				@Override
				public int compare(HashMap<String, Object> object1, HashMap<String, Object> object2) {
					int result = 0;
					//升序
							if (Long.parseLong(String.valueOf(object1.get("buy_jcxhlb_list_mid"))) > Long.parseLong(String.valueOf(object2.get("buy_jcxhlb_list_mid")))) {
								result = 1;
							} else if (Long.parseLong(String.valueOf(object1.get("buy_jcxhlb_list_mid"))) == Long.parseLong(String.valueOf(object2.get("buy_jcxhlb_list_mid")))) {
								result = 0;
							} else {
								result = -1;
							}

					return result;
				}
			});

		}
		return list;
	}
	
}
